var menu = [
	 ["01","회사 소개","/company/about_c.php"]
	,["0101","LS엠트론 소개","/company/about_c.php"]
	,["0102","트랙터 사업부 소개","/company/about_s.php"]
	,["02","공모전 소개","/about/about.php"]
	,["0201","공모전 소개","/about/about.php"]
	,["0202","공모전 기획배경","/about/plan.php"]
	,["03","공모전 참여","/participation/about.php"]
	,["0301","응모방법","/participation/about.php"]
	,["0302","참여하기","/participation/write.php"]
	,["0303","공모작 수정","/participation/password.php"]
	,["04","공모전 뉴스","/customer/notice.php?board_name=tbl_board_notice"]
	,["0401","공지사항","/customer/notice.php?board_name=tbl_board_notice"]
	,["0402","Q&A","/customer/qna.php?board_name=tbl_board_qna"]
	,["0403","FAQ","/customer/faq.php?board_name=tbl_board_faq"]

];

//@Left 메뉴셋팅
function leftMenuManager(pcd){
	if(!pcd)return;
    var  strM3dpth = '';
    for(var i=0; i < menu.length; i++){

        if(strM3dpth && menu[i][0].length < 6){
            document.write('<ol>'+strM3dpth+'</ol></li>');
            strM3dpth = '';
        }

        if(menu[i][0].substr(0,2) == pcd.substr(0,2)){
            if(menu[i][0].length==4){
				mCss="";
                if(menu[i][0] == pcd.substr(0,menu[i][0].length)) mCss='_on';
				var over = (!mCss) ? "over" : ""; //@ Left 현재 메뉴 고정
                document.write('<li><a href="'+menu[i][2]+'"  onfocus="blur()">' + '<img src="/images/lnbMenu' +menu[i][0] +mCss+'.gif" alt="' + menu[i][1] + '" class="'+over+'" /></a>');
            }else if(menu[i][0].length==6){
			   mCss='';
               if(menu[i][0] == pcd) mCss='on';
               strM3dpth += '<li><a href="'+menu[i][2]+'"  onfocus="blur()">' + '<img src="/images/lnbMenu' +menu[i][0] +mCss+'.gif" alt="' + menu[i][1] + '" class="over" /></a>';
            }
        }

        if(strM3dpth && (i==menu.length-1)){
            document.write('<ol>'+strM3dpth+'</ol></li>');
            strM3dpth = '';
        }
    }
}


//@Find menu code
function findMenuName(cd){
	var menuName = '';
	for(var i=0; i < menu.length; i++){
		if(menu[i][0]==cd){
			menuName = menu[i][1];
			break;
		}
	}
	return menuName;
}

//@Global Navigation
function globalNavigation(pcd){
	if(!pcd)return;
	var navi = '';
	var lastNaviNum = parseInt(pcd.length / 2,10);
	for(var y=1; y <= lastNaviNum; y++){

		mcd = pcd.substr(0,y*2);
		if(findMenuName(mcd)){
			if(y==lastNaviNum){
				navi +='<li class="present">'+findMenuName(mcd)+'</li>';
			}else{
				navi +='<li>'+findMenuName(mcd)+'</li>';
			}
		}
	}
	return '<li>Home</li> '+navi;
}
